import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.WindowConstants;

import java.awt.Rectangle;
import java.awt.Dimension;
import javax.swing.JTextArea;
import java.awt.Font;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.ImageIcon;

public class tradeGUI extends JFrame {

	private static final long serialVersionUID = 1L;
	private Players[] player;
	private MonopolyBoard board;
	private JPanel jContentPane = null;
	private JButton Player1 = null;
	private JFrame frame;
	private JButton Player2 = null;
	private JButton Player3 = null;
	private JButton Player4 = null;
	private JButton Player5 = null;
	private JButton Player6 = null;
	private JButton Player7 = null;
	private JButton Player8 = null;
	private JLabel TradeWithLabel = null;
	private JButton jButton = null;
	private Deeds[] deeds;
	private PropertyEvent property;
	
	/**
	 * This is the default constructor
	 */
	public tradeGUI(PropertyEvent property,Players[] player,MonopolyBoard board,JFrame frame,Deeds[] deeds) {
		super();
		this.property=property;
		this.player=player;
		this.frame=frame;
		this.board=board;
		this.deeds=deeds;
		
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(300, 318);
		this.setContentPane(getJContentPane());
		this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE) ;
		this.setTitle("JFrame");
		this.setVisible(true);
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			TradeWithLabel = new JLabel();
			TradeWithLabel.setBounds(new Rectangle(100, 26, 113, 24));
			TradeWithLabel.setFont(new Font("Dialog", Font.BOLD, 18));
			TradeWithLabel.setText("Trade With?");
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getPlayer1(), null);
			jContentPane.add(getPlayer2(), null);
			jContentPane.add(getPlayer3(), null);
			jContentPane.add(getPlayer4(), null);
			jContentPane.add(getPlayer5(), null);
			jContentPane.add(getPlayer6(), null);
			jContentPane.add(getPlayer7(), null);
			jContentPane.add(getPlayer8(), null);
			jContentPane.add(TradeWithLabel, null);
			jContentPane.add(getJButton(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes Player1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer1() {
		if (Player1 == null) {
			Player1 = new JButton();
			Player1.setBounds(new Rectangle(12, 77, 86, 30));
			Player1.setText("Player1");
			if(board.getTurn()==0){
				Player1.setEnabled(false);
				
			}
			Player1.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,1,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player1;
	}

	/**
	 * This method initializes Player2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer2() {
		if (Player2 == null) {
			Player2 = new JButton();
			Player2.setBounds(new Rectangle(13, 128, 89, 31));
			Player2.setText("Player2");
			if(board.getTurn()==1||player.length<2){
				Player2.setEnabled(false);
			
			}
			Player2.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,2,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player2;
	}

	/**
	 * This method initializes Player3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer3() {
		if (Player3 == null) {
			Player3 = new JButton();
			Player3.setBounds(new Rectangle(107, 75, 78, 28));
			Player3.setText("Player3");
			if(board.getTurn()==2||player.length<3){
				Player3.setEnabled(false);
				
			}
			Player3.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,3,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player3;
	}

	/**
	 * This method initializes Player4	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer4() {
		if (Player4 == null) {
			Player4 = new JButton();
			Player4.setBounds(new Rectangle(114, 129, 78, 29));
			Player4.setText("Player4");
			if(board.getTurn()==3||player.length<4){
				Player4.setEnabled(false);
				
			}
			Player4.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,4,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player4;
	}

	/**
	 * This method initializes Player5	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer5() {
		if (Player5 == null) {
			Player5 = new JButton();
			Player5.setBounds(new Rectangle(201, 75, 81, 29));
			Player5.setText("Player5");
			if(board.getTurn()==4||player.length<5){
				Player5.setEnabled(false);
				
			}
			Player5.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,5,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player5;
	}

	/**
	 * This method initializes Player6	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer6() {
		if (Player6 == null) {
			Player6 = new JButton();
			Player6.setBounds(new Rectangle(199, 130, 81, 28));
			Player6.setText("Player6");
			if(board.getTurn()==5||player.length<6){
				Player6.setEnabled(false);
				
			}
			Player6.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,6,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player6;
	}

	/**
	 * This method initializes Player7	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer7() {
		if (Player7 == null) {
			Player7 = new JButton();
			Player7.setBounds(new Rectangle(56, 170, 85, 31));
			Player7.setText("Player7");
			if(board.getTurn()==6||player.length<7){
				Player7.setEnabled(false);
				
			}
			Player7.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,7,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player7;
	}

	/**
	 * This method initializes Player8	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getPlayer8() {
		if (Player8 == null) {
			Player8 = new JButton();
			Player8.setBounds(new Rectangle(156, 173, 83, 29));
			Player8.setText("Player8");
			if(board.getTurn()==7||player.length<8){
				Player8.setEnabled(false);
				
			}
			Player8.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
					trade2GUI trade = new trade2GUI(property,8,board.getTurn(),frame,deeds,player);
					setVisible(false);
				}
			});
		}
		return Player8;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getJButton() {
		if (jButton == null) {
			jButton = new JButton();
			jButton.setBounds(new Rectangle(97, 227, 109, 31));
			jButton.setText("cancel trade");
			jButton.addActionListener(new java.awt.event.ActionListener() {
				public void actionPerformed(java.awt.event.ActionEvent e) {
				frame.setEnabled(true);
				setVisible(false);
				}
			});
		}
		return jButton;
	}


}  //  @jve:decl-index=0:visual-constraint="225,16"
